def searchAndReplace(text,search,replace):
    cur = 0
    total = 0
    data = []
    if text != '':
        searchText = text
        while True:
            flag = searchText.find(search)
            if not flag == -1 and not search == '':
                data.append(str(cur + flag + 1))
                searchText = searchText[flag + len(search):]
                cur = cur + flag + len(search)
                total += 1
            else:
                break
        print('替换结果：')
        print(text.replace(search, replace))
        print('替换次数', end='：')
        print(str(total), end='      ')
        print('原文中的起始位置', end='：')
        print(' '.join(data))


text = input('原文内容：').strip()
search = input('查找内容：').strip()
replace = input('替换为：').strip()
searchAndReplace(text, search, replace)
